home *** CD-ROM | disk | FTP | other *** search
INI File | 1989-01-11 | 5.6 KB | 125 lines |
- [SWTOOLS.DOC of JUGPDS Vol.52 & 53]
-
- Software Tools in Lattice C V3.1 & V20/V30/80186
-
-
- Original Version in BDS C
- by
- Hakuou KATAYOSE (JUG-CP/M No.179)
- 49-114 Kawauchi-Sanjuunin-machi,
- Sendai, Miyagi 980, Japan
- Phone: 0222-61-3219
-
-
- Modified for Lattice C (80186/V20/V30)
- by
- Toshiya Ota (JUG-CP/M No.10)
- Sakae ko-po 205 5-19-6 Hosoda
- Katusika-ku Tokyo 124
-
- Feb.10, 1987
-
- 1. Introduction
- Here is yet another version of Software Tools (Kernighan &
- Plauger) in Lattice C V3.1J. The original source programs in Ratfor have
- been translated into C. Also included are some utilities to compile and to
- demonstrate the application of the tools.
-
- 2. Programs from Software Tools
- I have implemented almost every program in Software Tools except for
- those in Chapter 6 "EDITING" and Chapter 9 "A RATFOR-FORTRAN TRANSLATOR".
-
- ------------------------------------------------------------------------
- Program Name Description (Page of the original K&P book)
- ------------------------------------------------------------------------
- COUNT (charcount + linecount + wordcount) (p12,13,15)
- DETAB/ENTAB Handling of TAB (p20,37)
- OVERSTRIK Overstrike of a line (p40)
- COMPRESS/EXPAND Compression and expansion of a text (p44,48)
- CRYPT0,CRYPT1 Encrypt of a text file. Note that a encrypt file may
- contain EOF marks; 0X01A(control-Z). CRYPT1 is to
- handle a binary file, it lacks the pipe and I/O
- redirection facilities of CRYPT0. I would recommend
- CRYPT1 as the more reliable.
- TRANSLIT Character transliteration (p56)
- COMPARE Comparison of two files (p70,73)
- CONCAT0,COMCAT1 Concatenation of text files (p78)
- ARCHIVE File archiver (p88)
- MSORT,SORT Sorting of a text file. MSORT can handle up to about
- 2000 lines or 30k bytes. SORT is for sorting with
- merge.
- UNIQUE Stripping adjacent duplicate lines (p125)
- KWIC/UNROT Keyword in context index (p128,131)
- FRQNCY Word frequency list for a document file (p126)
- FIND/CHANGE Find (grep) and change patterns in text (p139,156)
- FORMAT Text formatter (p234)
- MACRO Expand macros with arguments (p270)
- ------------------------------------------------------------------------
-
- To compile and link the source programs described above, you will
- need to include some header files (stdio.h, ctype.h) and the function
- libraries TOOLSLB.LIB. [The source for all four is included in JUGPDS
- Vols.52 and 53]
-
-
- 3. Some Notes on Translating Software Tools from Ratfor to Lattice C
-
- Since Ratfor is a preprocessor for Fortran, the parameters
- (arguments) for FUNCTIONs and SUBROUTINEs are referenced by address --
- pointers in the C language. You can not pass arguments by value unless
- you make appropriate changes to the C functions.
-
- The next point to watch is the difference of arrays. Fortran
- arrays start with element 1; C start at 0. If you declare A(50), you
- have the Ratfor array A(1)-A(50), but A[0]-A[4] in C. This difference
- is important when you specify the limits for a loop counter.
- Fortran-77 gives greater compatibility because it allows you to
- declare A(0:49).
- Also note that the elements of multi-dimensional arrays are stored
- in different orders -- by column in Fortran, by row in C.
-
- Fortran ... A(1,1),A(2,1),A(3,1),...
- C ... A[0][0],A[0][1],A[0][2],...
-
- So you have to exchange column and row for a two-dimensional array, if
- you want to use C pointers.
-
- 4. Another notes on Compiling/Using from T. Ota.
-
- a) Library
- All library functions is saparated from DEFF3.C and PAT.C (Original
- Library Source file). Lattice C (or other MS-DOS C compilers) generate only
- 1 modules from 1 source file. So , if library functions compiled by 1 file,
- then Object library (menber of .LIB file) has many functions ,and if linked
- main routine and library , useless functions linked togather.
- For that reason, I have saparated library functions to one by one.
-
- b) 80186 option
- Lattice C V3.1 can make the code for 80186. This mode generates 80186
- object code far more efficiently (in terms of memory and speed). So, I
- compiled allfunctions in both 8086 mode and 80186 mode.
- TOOLEXEN.ARC contains all executable files (.EXE files) which was compiled
- by 8086 mode. TOOLEXEV.ARC contains 80186 and V20/V30 executable files. You
- may choise either of them.
- Similarly, TOOLSLBN.LIB contains 8086 mode functions, and TOOLSLBV.LIB
- contains 80186 mode functions. You must copy either librariy to TOOLSLB.LIB
- for linking the programs.
-
- c) Note on MSORT.EXE
- MSORT.EXE uses much free memory. You must specify the stack size when
- you invoke the command.
- (Exsample: MSORT =9999 <infile >outfile)
-
- [ Disk Editors comments:
- The original of the source code of this disk is JUGPDS Vols.17 and 18.
- That code has been written in BDS C. The present version is based on Lattice
- C V3.1J. I tested the .EXE files on a NEC PC-9801E with V30. T.Ohta.
-
- Maynard Hogg (JUG-CP/M No.99) volunteered to improve this documen-
- tation. Thank you Maynard. Y.M. ]
-
- Written at 1987-02-08 02:39Z (GMT)
- ank you Maynard. Y.M. ]
-
- Written at 1987-02-08 02:39Z (GMT)